$package('Bdth.EnclosureBind');
Bdth.EnclosureBind = function () {
	var _box = null;
	var dvcId = $("#dvcId").val();
	var bindState = $("#bindState").val();
	var _this = {
		config: {
			dataGrid: {
				title: '围栏数据列表',
				url: path + '/sendEnclosure/dataList',
				queryParams: {"dvcId": dvcId, "bindState": bindState},
				columns: [[
					{field: 'enclosureId', checkbox: true, title: 'enclosureId'},
					{field: 'name', title: '围栏名称', width: 120, sortable: false},
					{
						field: 'enclosureType',
						title: '围栏类型',
						width: 120,
						sortable: false,
						formatter: function (value, rowData, rowIndex) {
							if (value == "polygon")
								return "多边形区域";
							else if (value == "rect")
								return "矩形区域";
							else if (value == "circle")
								return "圆形区域";
							else
								return "";
						}
					},
					{
						field: 'configType', title: '配置类型', width: 120, sortable: false,
						formatter: function (value, rowData, rowIndex) {
							if (value == "0")
								return "更新区域";
							else if (value == "1")
								return "追加区域";
							else if (value == "2")
								return "修改区域";
							else if (value == "3")
								return "删除区域";
							else
								return "";
						}
					},
					{
						field: 'bindType',
						title: '绑定类型',
						width: 120,
						sortable: false,
						formatter: function (value, rowData, rowIndex) {
							if (value == "platform")
								return "平台报警";
							else if (value == "terminal")
								return "终端报警";
							else
								return "未绑定";
						}
					},
					{
						field: 'commandStatus',
						title: '执行状态',
						width: 100,
						sortable: false,
						formatter: function (value, rowData, rowIndex) {
							var bindType = rowData.bindType;
							if (bindType  == "terminal" || bindType  == "platform")
								return "绑定成功";
							else
								return "";
						}
					},
					{field: 'createDate', title: '执行时间', width: 160, sortable: false},
				]]
			},
		},
		init: function () {
			_box = new DataGrid(_this.config);
			_box.init();
		}
	}
	return _this;
}();

$(function () {
	Bdth.EnclosureBind.init();
});		